package com.wen.business.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wen.common.pojo.account.Book;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;

import java.util.List;

@Mapper
public interface BookMapper extends BaseMapper<Book> {
    // 根据用户id查询图书信息
    @Select("select `book`.*, `user`.nick_name from `book` left join `user` on `book`.user_id = `user`.id where `book`.user_id = #{userId}")
    List<Book> findByUserId(@Param("userId") Integer userId);
}